; Setup script for D-Link Gigabit Ethernet Adapters
[Identification]
	OptionType = NetAdapter
[PlatformsSupported]
	PCI
[Options]
	

	GEV2COPPER
       GEY2COPPER4360

[CardIds]
PCIID_1		= "0x11864B00", {"", 4486, 19200}
PCIID_2		= "0x11864C00", {"", 4486, 19456}
PCIID_3		= "0x11864B01", {"", 4486, 19201}
    

[PreferredPort_Choices]
	PREFERREDPORT_1		= 1, "A"
	PREFERREDPORT_2		= 2, "B"
[RlmtMode_Choices]
	RLMTMODE_1		= 1, "CLS"
	RLMTMODE_3		= 3, "CLP"
	RLMTMODE_7		= 7, "CLPSS"


[ConnectionType]
	CONNECTIONTYPE_1		= 0, "AutoSense"
	CONNECTIONTYPE_2		= 1, "10Mbps Half Duplex"
	CONNECTIONTYPE_3		= 2, "10Mbps Full Duplex"
	CONNECTIONTYPE_4 		= 3, "100Mbps Half Duplex"
	CONNECTIONTYPE_5 		= 4, "100Mbps Full Duplex"

[MaxFrameSize]
	MAXFRAMESIZE_1		= 1514, "Off"
	MAXFRAMESIZE_2		= 9014, "On"
	

[FileConstants]
	ParamInf		= "NCPARAM.INF"
	UtilityInf		= "UTILITY.INF"
	subroutineinf		= "SUBROUTN.INF"
	SoftwareType		= "driver"
	Exit_Code		= 0
	NetEventDLL		= "%SystemRoot%\System32\Drivers\m4cxnt4.sys"
	IoLogMsgDLL		= "%SystemRoot%\System32\IoLogMsg.dll"

        EthCards		= {GEV2COPPER, GEY2COPPER4360}

	Manufacturer		= "D-Link"
	Card_IDs		= ^(CardIds, 2)

	MediaTypeDefault	= 1
	
    	PreferredPortValList	= ^(PreferredPort_Choices, 1)
	PreferredPortStrList	= ^(PreferredPort_Choices, 2)
	PreferredPortDefault	= *($(PreferredPortValList), 1)
	
        RlmtModeValList		= ^(RlmtMode_Choices, 1)
	RlmtModeStrList		= ^(RlmtMode_Choices, 2)
	RlmtModeDefault		= *($(RlmtModeValList), 1)
	
        MaxMulticastDefault	= 128
	DupCapBDefault		= 3
	AutoNegBDefault		= 1
	FlowControlADefault	= 3
	FlowControlBDefault	= 3
	RoleBDefault		= 0
        
	JumboSupportValList	= ^(MaxFrameSize, 1)
	JumboSupportStrList	= ^(MaxFrameSize, 2)
	JumboSupportDefault	= *($(JumboSupportValList), 1)

    	ConnectionTypeValList	= ^(ConnectionType, 1)
	ConnectionTypeStrList	= ^(ConnectionType, 2)
	ConnectionTypeADefault	= *($(ConnectionTypeValList), 1)


        RoleValList		= ^(RoleCapabilities, 1)
	RoleStrList	        = ^(RoleCapabilities, 2)
	RoleADefault		= *($(RoleValList), 1)

	ProductMajorVersion	= "7"
	ProductMinorVersion	= "42"
	
	
	ProductSoftwareName	= "M4CXNT4"
	ProductSoftwareImagePath= "\SystemRoot\System32\Drivers\m4cxnt4.sys"
	NetRuleSoftwareType	= "m4cxnt4Sys ndisDriver m4cxnt4Driver"
	NetRuleSoftwareBindForm = """m4cxnt4Sys"" yes no container"
	NetRuleSoftwareClass	= {"m4cxnt4Driver basic"}
	NetRuleSoftwareBindable = {"m4cxnt4Driver m4cxnt4Adapter non exclusive 100"}
	ProductHardwareName	= "m4cxnt4"
	NetRuleHardwareType	= "m4cxnt4 m4cxnt4Adapter"
	NetRuleHardwareClass	= {"m4cxnt4Adapter basic"}
	ProductVersion		= $(ProductMajorVersion)"."$(ProductMinorVersion)
	NetRuleHardwareBindForm = " yes yes container"
	ProductKeyName		= $(!NTN_SoftwareBase)"\"$(Manufacturer)"\"+
				  $(ProductSoftwareName)"\CurrentVersion"
	ParamKeyName		= $(!NTN_ServiceBase)$(ProductHardwareName)"\Parameters"
	NetRuleSoftwareUse	= $(SoftwareType)
[GeneralConstants]
	from			= ""
	to			= ""
	ExitCodeOk		= 0
	ExitCodeCancel		= 1
	ExitCodeFatal		= 2
	KeyNull 		= ""
	MAXIMUM_ALLOWED 	= 33554432
	RegistryErrorIndex	= NO_ERROR
	KeyProduct		= ""
	KeyParameters		= ""
	TRUE			= 1
	FALSE			= 0
	NoTitle 		= 0
	ExitState		= "Active"
	OldVersionExisted	= $(FALSE)
	DriverPath		= $(!STF_NTPATH)\drivers
[date]
	Now = {} ? $(!LIBHANDLE) GetSystemDate
[Identify]
	read-syms Identification
	Set Status	= STATUS_SUCCESSFUL
	Set Identifier	= $(OptionType)
	Set Media	= #("Source Media Descriptions", 1, 1)
	Return $(Status) $(Identifier) $(Media)
[ReturnOptions]
	Set Status		= STATUS_FAILED
	Set OptionList		= {}
	Set OptionTextList	= {}
	Set LanguageList	= ^(LanguagesSupported, 1)
	IfContains(i) $($0) in $(LanguageList)
		IfStr(i) $($1) == ""
			goto returnoptions
		EndIf
		Set PlatformList = ^(PlatformsSupported, 1)
		IfContains(i) $($1) in $(PlatformList)
			goto returnoptions
		Else
			Set Status = STATUS_NOTSUPPORTED
			goto finish_ReturnOptions
		EndIf
	Else
		Set Status = STATUS_NOLANGUAGE
		goto finish_ReturnOptions
	EndIf
returnoptions = +
	Set OptionList		= ^(Options, 1)
	Set OptionTextList	= ^(OptionsText$($0), 1)
	Set Status		= STATUS_SUCCESSFUL
finish_ReturnOptions = +
	Return $(Status) $(OptionList) $(OptionTextList)
[InstallOption]
	Set InfOption		= $($1)
	Set Option		= $($1)
	Set SrcDir		= $($2)
	Set AddCopy		= $($3)
	Set DoCopy		= $($4)
	Set DoConfig		= $($5)
	Set LanguageList	= ^(LanguagesSupported, 1)
	IfContains(i) $($0) NOT-IN $(LanguageList)
		Return STATUS_NOLANGUAGE
	EndIf
	Set-subst LF = "\n"
	read-syms GeneralConstants
	read-syms FileConstants
	read-syms DialogConstants$(!STF_LANGUAGE)
	IfStr(i) $(!NTN_Origination) == "NCPA"
		Set Continue = $(OK)
	EndIf
	read-syms FileConstants$(!STF_LANGUAGE)
	detect date
	Set-title  $(Function$(Option)Title)
	Set to			= Begin
	Set from		= Begin
	Set CommonStatus	= STATUS_SUCCESSFUL
	EndWait
Begin = +
	Set ActivateDetection = FALSE
	Set BusNumList = {}
	Set Combo1List = {}
	IfStr(i) $(!NTN_InstallMode) == deinstall
		Goto checkmode
	Else-IfStr(i) $(!NTN_InstallMode) == update
		Goto checkmode
	Else-IfStr(i) $(!NTN_InstallMode) == bind
		Goto checkmode
	EndIf
	Set BusNumber		= 0
	Set BusInterfaceType	= 5
	Set BusTypeStr		= "Pci"
	Set AdaptersFoundFlag	= FALSE
	IfStr(i) *($(!STF_BUSTYPELIST),1) == ""
		Shell $(UtilityInf), GetBusTypeNum
		Set BusTypeNum = $($R1)
	Else
		Set BusTypeNum = 5
	EndIf
	Set OptionList = ^(Options, 1)
	ForListDo $(Card_IDs)
		Set PCIVendorID = *($($), 2)
		Set PCIDeviceID = *($($), 3)
		Shell $(UtilityInf), GetPCIInformation, $(PCIVendorID), $(PCIDeviceID)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			Goto ShellCodeError
		EndIf
		IfStr(i) $($R0) != {}
			ForListDo $($R0)
				Set BusNum	= *($($),1)
				Set SlotNum	= *($($),2)
				Set AdaptersFoundFlag	= TRUE
				Set NicAlreadyInstalled = FALSE
				ForListDo $(OptionList)
					Shell $(UtilityInf), +
						IsNetCardAlreadyInstalled, +
						$(BusNum), $(SlotNum), +
						$(ProductHardware$($)Description), +
						$(ProductHardwareName)
					IfInt $($ShellCode) != $(!SHELL_CODE_OK)
						goto ShellCodeError
					Endif
					Ifstr $($R0) != "NO_ERROR"
						set Error = $($R0)
						goto fatal
					Endif
					IfStr(i) $($R1) != "NO"
						Set NicAlreadyInstalled = TRUE
					EndIf
				EndForListDo
				IfStr(i) $(NicAlreadyInstalled) == FALSE
					Set Combo1List	= >($(Combo1List),$(BusNum)" / "$(SlotNum))
				EndIf
			EndForListDo
		EndIf
	EndForListDo
	IfStr(i) $(Combo1List) == {}
		IfStr(i) $(AdaptersFoundFlag) == FALSE
			Set Error = "Error: No "+
				  $(ProductHardware$(InfOption)Title)+
				  " installed."
			Goto fatal
		Endif
		IfStr(i) $(!NTN_InstallMode) == install
			Set Error	= "Error: No further "+
				  $(ProductHardware$(InfOption)Title)+
				  " installed."
			Goto fatal
		EndIf
	EndIf
checkmode = +
	IfStr(i) $(!NTN_InstallMode) == deinstall
		Set StartLabel = removeadapter
	Else-IfStr(i) $(!NTN_InstallMode) == update
		Set StartLabel = UpgradeSoftware
	Else-IfStr(i) $(!NTN_InstallMode) == bind
		Set StartLabel = bindingadapter
	Else-IfStr(i) $(!NTN_InstallMode) == configure
		Set CommonStatus = STATUS_REBOOT
		Set StartLabel = configureadapter
		IfStr(i) $(ProductKeyName) == $(!NTN_RegBase)
			Shell $(UtilityInf), RegistryErrorString, CANNOT_CONFIGURE_SOFTWARE
			IfInt $($ShellCode) != $(!SHELL_CODE_OK)
				goto ShellCodeError
			EndIf
			Set Error	= $($R0)
			Set from	= end
			Set to		= end
			goto nonfatalinfo
		EndIf
	Else
		Set AddCopy                     = "YES"
		Set DoCopy                      = "YES"
		Set !STF_SRCDIR_OVERRIDE        = $(SrcDir)
		IfStr(i) $(DoCopy) == "YES"
			IfStr(i) $(!STF_SRCDIR_OVERRIDE) != ""
				Install Install-Helpfile
			EndIf
		EndIf
		Set StartLabel			= installadapter
		Set OEM_ABANDON_OPTIONS 	= {}
		Set OEM_ABANDON_SOFTWARE	= FALSE
		Set OEM_ABANDON_ON		= TRUE
	EndIf
	Set CardMediaType	= $(MediaTypeDefault)
	Set MaxMulticast	= $(MaxMulticastDefault)
	

	Set JumboSupp	        = $(JumboSupportDefault)
        Set ConnTypeA           = $(ConnectionTypeADefault)

	Set RoleA		= $(RoleADefault)
        Set FlowControlA	= $(FlowControlADefault)

	IfStr(i) $(Option) == "GEV2COPPER"
                Set SpeedModeValue	= $(SpeedADefault)
       EndIf
	IfStr(i) $(Option) == "GEY2COPPER4360"
		Set SpeedModeValue	= $(SpeedADefault)
	EndIf

	Set DetectedCard = FALSE
	IfStr(i) $(ActivateDetection) != TRUE
		Goto skipdetection
	EndIf

	Shell $(ParamInf), Param_BuildTypeLists, M4CXNT4, $(TypeList)
	Set Status = $($R0)
	IfStr(i) $(Status) != STATUS_SUCCESSFUL
		Goto fatal
	EndIf
	Shell $(ParamInf), Param_SetDefaults, {}
	IfStr(i) $(!STF_NCDETECT) == YES
		IfStr(i) $(!STF_NCOPTION) == $(Option)
			Set DetectedCard = TRUE
		EndIf
	EndIf
skipdetection = +
	Set from	= $(fatal)
	Set to		= $(fatal)
	goto $(StartLabel)
installadapter = +
	OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) $(MAXIMUM_ALLOWED) KeyProduct
	IfStr $(KeyProduct) != $(KeyNull)
		CloseRegKey $(KeyProduct)
		IfStr(i) !(NTN_RegBase) == $(ProductKeyName)
			Shell $(UtilityInf), VerExistedDlg, $(ProductSoftware$(Option)Title),+
			  $(ProductVersion)
			IfInt $($ShellCode) != $(!SHELL_CODE_OK)
				goto ShellCodeError
			EndIf
			goto end
		Else
			Shell $(UtilityInf), CardExistedDlg
			IfInt $($ShellCode) != $(!SHELL_CODE_OK)
				goto ShellCodeError
			EndIf
			IfStr(i) $($R1) != "OK"
				Set CommonStatus = STATUS_USERCANCEL
				goto end
			EndIf
			Set OldVersionExisted = $(TRUE)
		EndIf
	EndIf
	IfStr(i) $(DetectedCard) != TRUE
		Goto adaptersetup
	EndIf
	StartWait
	Shell $(ParamInf), Param_QueryCard, $(!STF_NCDETCARD)
	EndWait
	IfStr(i) $($R0) != STATUS_SUCCESSFUL
		Goto adaptersetup
	EndIf
	Set DetectedParams = $($R1)
	Shell $(ParamInf), Param_SetDefaults, $(DetectedParams)
	goto adapteroptions
configureadapter = +
	IfStr $(KeyProduct) == $(KeyNull)
		OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase) $(MAXIMUM_ALLOWED) KeyProduct
		IfStr $(KeyProduct) == $(KeyNull)
			Set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
			goto fatalregistry
		EndIf
	EndIf
	Shell $(UtilityInf), FindService, $(KeyProduct)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		Goto ShellCodeError
	EndIf
	IfStr(i) $($R0) != NO_ERROR
		Goto fatalregistry
	EndIf
	Set KeyParameters = $($R2)
	CloseRegKey $($R1)
	IfStr $(KeyParameters) == $(KeyNull)
		Set RegistryErrorIndex = CANNOT_FIND_COMPONENT_SERVICE
		goto fatalregistry
	EndIf
	Set OldVersionExisted	= $(TRUE)
	Set ValueName		= ""
	Set ValueData		= ""
	Set ValueStr		= ""
	Set ValueList		= {}
	EnumRegValue $(KeyParameters) ValueList
	ForListDo $(ValueList)
		Set ValueItem	= $($)
		Set ValueName	= *($(ValueItem),1)
		Set ValueData	= *($(ValueItem),4)
		IfStr(i) $(ValueName) == "SlotNumber"
			Set SlotNumber		= $(ValueData)
                Else-IfStr(i) $(ValueName) == "MediaType"
                        Set CardMediaType       = $(ValueData)
		Else-IfStr(i) $(ValueName) == "NetworkAddress"
			Set NetworkAddress	= $(ValueData)
		Else-IfStr(i) $(ValueName) == "MaxMulticast"
			Set MaxMulticast	= $(ValueData)


		Else-IfStr(i) $(ValueName) == "MaxFrameSize"
			Set JumboSupp		= $(ValueData)

        	Else-IfStr(i) $(ValueName) == "ConnectionType_A"
			Set ConnTypeA		= $(ValueData)
                Else-IfStr(i) $(ValueName) == "Role_A"
			Set RoleA		= $(ValueData)

                Else-IfStr(i) $(ValueName) == "FlowControl_A"
			Set FlowControlA	= $(ValueData)
		
                Else-IfStr(i) $(ValueName) == "PreferredPort"
			Set PreferredPortValue	= $(ValueData)
		Else-IfStr(i) $(ValueName) == "RlmtMode"
			Set RlmtModeValue	= $(ValueData)

                Else-IfStr(i) $(ValueName) == "Role_B"
			Set RoleB		= $(ValueData)

		Else-IfStr(i) $(ValueName) == "FlowControl_B"
			Set FlowControlB	= $(ValueData)

		
		EndIf
		IfStr(i) $(BusTypeStr) == "Pci"
			IfStr(i) $(ValueName) == "BusNumber"
				Set BusNumber		= $(ValueData)
			EndIf
		EndIf
	EndForListDo
	Set Combo1List	= >($(Combo1List),$(BusNumber)" / "$(SlotNumber))
adaptersetup = +
	IfStr(i) $(DetectedCard) == TRUE
		IfStr(i) $(!STF_INSTALL_MODE) != CUSTOM
			Goto adapterverify
		EndIf
	EndIf
	goto adapteroptions
adapteroptions = +
	IfStr(i) $(!STF_GUI_UNATTENDED) == "YES"
		IfStr(i) $(!AutoNetInterfaceType) != ""
			set BusInterfaceType = $(!AutoNetInterfaceType)
		EndIf
		IfStr(i) $(!AutoNetBusNumber) != ""
			set BusNumber = $(!AutoNetBusNumber)
		EndIf
		goto adapteroptions2
	EndIf
	Set from = adapteroptions
	Set SlotNumber = $(BusNumber)" / "$(SlotNumber)
	Goto adapteroptions2
adapteroptions2 = +
	IfStr(i) $(!STF_GUI_UNATTENDED) == "YES"
		Split-String *($(Combo1List),1) " " Combo1Elements
		Set BusNumber   = *($(Combo1Elements),1)
		Set SlotNumber  = *($(Combo1Elements),5)
		goto adapterverify
	EndIf


	 IfStr(i) $(Option) == "GEV2COPPER"       
		Set JumboSupportStr = *($(JumboSupportStrList), ~($(JumboSupportValList), $(JumboSupp)))
		Set ConnectionTypeStr = *($(ConnectionTypeStrList), ~($(ConnectionTypeValList), $(ConnTypeA)))
		Set RoleStr      = *($(RoleStrList),      ~($(RoleValList),      $(RoleA)))
	EndIf

	
        IfStr(i) $(Option) == "GEY2COPPER4360"
                Set JumboSupportStr = *($(JumboSupportStrList), ~($(JumboSupportValList), $(JumboSupp)))
                Set ConnectionTypeStr = *($(ConnectionTypeStrList), ~($(ConnectionTypeValList), $(ConnTypeA)))
                Set RoleStr      = *($(RoleStrList),      ~($(RoleValList),      $(RoleA)))
        EndIf

	read-syms FileDependentDlg$(Option)$(!STF_LANGUAGE)
	LoadLibrary "disk3" $(HelpFile).dll hLib
	SetHelpFile $(HelpFile).hlp $(MinID) $(MaxID)
	ui start "InputDlg" $(hLib)
	FreeLibrary $(hLib)
	IfStr(i) $(DLGEVENT) == "CONTINUE"
		Set NetworkAddress = *($(EditTextOut),1)
		Split-String $(Combo1Out) " " Combo1Elements
		Set BusNumber   = *($(Combo1Elements),1)
		Set SlotNumber  = *($(Combo1Elements),5)




		IfStr(i) $(Option) == "GEV2COPPER"
			Set JumboSupportStr	= $(Combo2Out)
			Set JumboSupp = *($(JumboSupportValList),+
				~($(JumboSupportStrList), $(JumboSupportStr)))

					Set ConnectionTypeStr	= $(Combo3Out)
			Set ConnTypeA = *($(ConnectionTypeValList),+
				~($(ConnectionTypeStrList), $(ConnectionTypeStr)))
		EndIf

		

                ifstr(i) $(Option) == "GEY2COPPER4360"
			Set JumboSupportStr	= $(Combo2Out)
			Set JumboSupp = *($(JumboSupportValList),+
				~($(JumboSupportStrList), $(JumboSupportStr)))

            		Set ConnectionTypeStr	= $(Combo3Out)
			Set ConnTypeA = *($(ConnectionTypeValList),+
				~($(ConnectionTypeStrList), $(ConnectionTypeStr)))
                EndIf

		ui pop 1
	Else-IfStr(i) $(DLGEVENT) == "BACK"
		Set CommonStatus = STATUS_USERCANCEL
		ui pop 1
		goto end
	Else
		ui pop 1
		goto end
	EndIf
adapterverify = +
	IfStr(i) $(DetectedCard) != TRUE
		Goto skipoptions
	EndIf
	Shell $(ParamInf), Param_VerifyCard, $(!STF_NCDETCARD)
	IfStr(i) $($R0) == STATUS_SUCCESSFUL
		Goto skipoptions
	EndIf
	Set from	= adapteroptions
	Set to		= skipoptions
	Shell $(UtilityInf), RegistryErrorString, VERIFY_WARNING
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		goto ShellCodeError
	EndIf
	Set Error = $($R0)
	Goto Warning
skipoptions = +
	IfInt $(OldVersionExisted) == $(TRUE)
		IfStr(i) $(!NTN_InstallMode) == configure
			goto writeparameters
		EndIf
	EndIf
	StartWait
	IfInt $(OldVersionExisted) == $(FALSE)
		IfStr(i) $(!NTN_InstallMode) == "install"
			IfStr(i) $(DoCopy) == "YES"
				Shell $(UtilityInf), DoAskSource, $(!STF_CWDDIR), $(SrcDir), YES
				IfInt $($ShellCode) != $(!SHELL_CODE_OK)
					Goto ShellCodeError
				Else-IfStr(i) $($R0) == STATUS_FAILED
					Shell $(UtilityInf),+
					  RegistryErrorString, "ASK_SOURCE_FAIL"
					IfInt $($ShellCode) != $(!SHELL_CODE_OK)
						goto ShellCodeError
					EndIf
					Set Error = $($R0)
					Goto fatal
				Else-IfStr(i) $($R0) == STATUS_USERCANCEL
					Goto successful
				EndIf
				Set SrcDir = $($R1)
			EndIf
			install "Install-Option"
			IfStr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
				Shell $(UtilityInf), RegistryErrorString, "UNABLE_COPY_FILE"
				IfInt $($ShellCode) != $(!SHELL_CODE_OK)
					goto ShellCodeError
				EndIf
				Set Error = $($R0)
				goto fatal
			EndIf
		EndIf
		Shell $(UtilityInf), AddSoftwareComponent, $(Manufacturer),+
		  $(ProductSoftwareName), $(ProductSoftwareName),+
		  $(ProductSoftware$(Option)Title), $(STF_CONTEXTINFNAME),+
		  $(ProductSoftwareImagePath), "kernel", "NDIS", {}, "",+
		  $(NetEventDLL)
		Set OEM_ABANDON_SOFTWARE = TRUE
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			goto ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			EndWait
			CloseRegKey $($R1)
			CloseRegKey $($R2)
			CloseRegKey $($R3)
			CloseRegKey $($R4)
			CloseRegKey $($R5)
			goto fatalregistry
		EndIf
		Set SoftProductKey	= $($R1)
		Set SoftNetRuleKey	= $($R2)
		Set SoftServiceKey	= $($R3)
		Set SoftParameterKey	= $($R4)
		Set SoftLinkageKey	= $($R5)
		Set NewValueList	= {+
		  {SoftwareType,$(NoTitle),$(!REG_VT_SZ),$(SoftwareType)},+
		  {MajorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMajorVersion)},+
		  {MinorVersion,$(NoTitle),$(!REG_VT_DWORD),$(ProductMinorVersion)},+
		  {Title,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftware$(Option)Title)},+
		  {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftware$(InfOption)Description)},+
		  {ServiceName,$(NoTitle),$(!REG_VT_SZ),$(ProductSoftwareName)},+
		  {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}+
		}
		Shell $(UtilityInf), AddValueList, $(SoftProductKey), $(NewValueList)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			goto ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			EndWait
			CloseRegKey $(SoftProductKey)
			CloseRegKey $(SoftNetRuleKey)
			CloseRegKey $(SoftServiceKey)
			CloseRegKey $(SoftParameterKey)
			CloseRegKey $(SoftLinkageKey)
			goto fatalregistry
		EndIf
		Set NewValueList	= {+
		  {type,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareType)},+
		  {use,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareUse)},+
		  {bindform,$(NoTitle),$(!REG_VT_SZ),$(NetRuleSoftwareBindForm)},+
		  {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleSoftwareClass)},+
		  {bindable,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleSoftwareBindable)},+
		  {InfOption,$(NoTitle),$(!REG_VT_SZ),$(InfOption)}+
		}
		Shell $(UtilityInf), AddValueList, $(SoftNetRuleKey), $(NewValueList)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			goto ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		CloseRegKey $(SoftProductKey)
		CloseRegKey $(SoftNetRuleKey)
		CloseRegKey $(SoftServiceKey)
		CloseRegKey $(SoftParameterKey)
		CloseRegKey $(SoftLinkageKey)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			EndWait
			goto fatalregistry
		EndIf
	EndIf
	Shell $(UtilityInf), AddHardwareComponent, $(ProductHardwareName),+
	  $(STF_CONTEXTINFNAME), $(ProductKeyName)
	IfInt $($R4) != -1
		Set OEM_ABANDON_OPTIONS = >($(OEM_ABANDON_OPTIONS),+
		  $(!NTN_SoftwareBase)"\Microsoft\Windows NT\CurrentVersion\NetworkCards\"$($R4))
	EndIf
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		goto ShellCodeError
	EndIf
	Set RegistryErrorIndex = $($R0)
	IfStr(i) $(RegistryErrorIndex) != NO_ERROR
		EndWait
		CloseRegKey $($R1)
		CloseRegKey $($R2)
		CloseRegKey $($R3)
		goto fatalregistry
	EndIf
	Set KeyParameters	= $($R3)
	Set KeyAdapterRules	= $($R2)
	Set AdapterNumber	= $($R4)
	Set NewValueList	= {+
	  {Manufacturer,$(NoTitle),$(!REG_VT_SZ),$(Manufacturer)},+
	  {Title,$(NoTitle),$(!REG_VT_SZ),"["$($R4)"] "$(ProductHardware$(InfOption)Title)},+
	  {Description,$(NoTitle),$(!REG_VT_SZ),$(ProductHardware$(InfOption)Description)},+
	  {ProductName,$(NoTitle),$(!REG_VT_SZ),$(ProductHardwareName)},+
	  {ServiceName,$(NoTitle),$(!REG_VT_SZ),$($R5)},+
	  {InstallDate,$(NoTitle),$(!REG_VT_DWORD),*($(Now),1)}+
	}
	Shell $(UtilityInf), AddValueList, $($R1), $(NewValueList)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		goto ShellCodeError
	EndIf
	CloseRegKey $($R1)
	Set TempProdName	= """"$(ProductHardwareName)$(AdapterNumber)""""
	Set TempBindForm	= $(TempProdName)$(NetRuleHardwareBindForm)
	Set NewValueList	= {+
	  {type,$(NoTitle),$(!REG_VT_SZ),$(NetRuleHardwareType)},+
	  {bindform,$(NoTitle),$(!REG_VT_SZ),$(TempBindForm)},+
	  {class,$(NoTitle),$(!REG_VT_MULTI_SZ),$(NetRuleHardwareClass)},+
	  {InfOption,$(NoTitle),$(!REG_VT_SZ),$(InfOption)}+
	}
	Shell $(UtilityInf), AddValueList, $(KeyAdapterRules), $(NewValueList)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		goto ShellCodeError
	EndIf
	Set RegistryErrorIndex = $($R0)
	IfStr(i) $(RegistryErrorIndex) != NO_ERROR
		EndWait
		CloseRegKey $(KeyParameters)
		CloseRegKey $(KeyAdapterRules)
		goto fatalregistry
	EndIf
	CloseRegKey $(KeyAdapterRules)
	goto writeparameters
writeparameters = +
	IfContains $(Option) in $(EthCards)


        ifstr(i) $(Option) == "GEV2COPPER"
		Set NewValueList = {+
			{BusNumber,$(NoTitle),$(!REG_VT_DWORD),$(BusNumber)},+
			{MediaType,$(NoTitle),$(!REG_VT_DWORD),$(CardMediaType)},+
			{BusType,$(NoTitle),$(!REG_VT_DWORD),$(BusTypeNum)},+
			{SlotNumber,$(NoTitle),$(!REG_VT_DWORD),$(SlotNumber)},+
			{Moderate,$(NoTitle),$(!REG_VT_DWORD),1},+
			{FixedIntMod,$(NoTitle),$(!REG_VT_DWORD),5000},+
			{MaxReceives,$(NoTitle),$(!REG_VT_DWORD),50},+
			{MaxTransmits,$(NoTitle),$(!REG_VT_DWORD),50},+
			{WaitForRxResources,$(NoTitle),$(!REG_VT_DWORD),1},+
			{MessageLog,$(NoTitle),$(!REG_VT_DWORD),1},+
		}
	EndIf	
       ifstr(i) $(Option) == "GEY2COPPER4360"
		Set NewValueList = {+
			{BusNumber,$(NoTitle),$(!REG_VT_DWORD),$(BusNumber)},+
			{MediaType,$(NoTitle),$(!REG_VT_DWORD),$(CardMediaType)},+
			{BusType,$(NoTitle),$(!REG_VT_DWORD),$(BusTypeNum)},+
			{SlotNumber,$(NoTitle),$(!REG_VT_DWORD),$(SlotNumber)},+
			{Moderate,$(NoTitle),$(!REG_VT_DWORD),1},+
			{FixedIntMod,$(NoTitle),$(!REG_VT_DWORD),5000},+
			{MaxReceives,$(NoTitle),$(!REG_VT_DWORD),256},+
			{MaxTransmits,$(NoTitle),$(!REG_VT_DWORD),256},+
			{WaitForRxResources,$(NoTitle),$(!REG_VT_DWORD),1},+
			{MessageLog,$(NoTitle),$(!REG_VT_DWORD),1},+
		}
        EndIf

		Set EthParmsList = {+
                        {NetworkAddress,$(NoTitle),$(!REG_VT_SZ),$(NetworkAddress)},+

                        {MaxMulticast,$(NoTitle),$(!REG_VT_DWORD),$(MaxMulticast)},+

                        {MaxFrameSize,$(NoTitle),$(!REG_VT_DWORD),$(JumboSupp)},+
                        {ConnectionType_A,$(NoTitle),$(!REG_VT_DWORD),$(ConnTypeA)},+
		  
                        {FlowControl_A,$(NoTitle),$(!REG_VT_DWORD),$(FlowControlA)},+
                        {Role_A,$(NoTitle),$(!REG_VT_DWORD),$(RoleA)},+
		}
                
		ForListDo $(EthParmsList)
			Set NewValueList = >($(NewValueList),$($))
		EndForListDo



		IfStr(i) $(Option) == "GEV2COPPER"
	            	Set CopperV2ParmsList = {+
				  {MaxFrameSize,$(NoTitle),$(!REG_VT_DWORD),$(JumboSupp)},+
				  {ConnectionType_A,$(NoTitle),$(!REG_VT_DWORD),$(ConnTypeA)},+
			}
			ForListDo $(CopperV2ParmsList)
				Set NewValueList = >($(NewValueList),$($))
			EndForListDo
		EndIf

		

        ifstr(i) $(Option) == "GEY2COPPER4360"
                Set CopperV2ParmsList = {+
                        {MaxFrameSize,$(NoTitle),$(!REG_VT_DWORD),$(JumboSupp)},+
                        {ConnectionType_A,$(NoTitle),$(!REG_VT_DWORD),$(ConnTypeA)},+
                        }
                ForListDo $(CopperV2ParmsList)
                        Set NewValueList = >($(NewValueList),$($))
                EndForListDo
        EndIf

		Shell $(UtilityInf), AddValueList, $(KeyParameters), $(NewValueList)
		ifstr(i) $(!STF_GUI_UNATTENDED) == "YES"
			Shell $(UtilityInf),AddDefaultNetCardParameters,$(KeyParameters)
		endif
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			goto ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			CloseRegKey $(KeyParameters)
			goto fatalregistry
		EndIf
	EndIf
	CloseRegKey $(KeyParameters)
	EndWait
	goto successful
bindingadapter = +
	Set Error = "Binding: Sorry, not yet implemented."
	goto fatal
removeadapter = +
	IfStr(i) $(ProductKeyName) == $(!NTN_RegBase)
		Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer),+
		  $(ProductSoftwareName)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			goto ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			goto fatalregistry
		EndIf
	Else
		Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer),+
		  $(ProductHardwareName), $(!NTN_RegBase)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			goto ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			goto fatalregistry
		EndIf
	EndIf
	goto end
UpgradeSoftware = +
	OpenRegKey $(!REG_H_LOCAL) "" $(!NTN_RegBase)\NetRules +
		$(MAXIMUM_ALLOWED) KeyProduct
	IfStr $(KeyProduct) != $(KeyNull)
		GetRegValue $(KeyProduct), "InfName", InfName
		QueryListSize ListSize $(InfName)
		Set !UG_Filename = *($(InfName), $(ListSize))
		CloseRegKey $(KeyProduct)
	Else
		goto fatalregistry
	EndIf

	OpenRegKey $(!REG_H_LOCAL) "" $(ProductKeyName) +
		$(MAXIMUM_ALLOWED) KeyProduct
	IfStr $(KeyProduct) != $(KeyNull)
		Install "Install-Update"
		IfStr(i) $(STF_INSTALL_OUTCOME) != STF_SUCCESS
			goto fatal
		EndIf
		SetRegValue $(KeyProduct) {MajorVersion, $(NoTitle),+
			$(!REG_VT_SZ), $(ProductMajorVersion)}
		SetRegValue $(KeyProduct) {MinorVersion, $(NoTitle),+
			$(!REG_VT_SZ), $(ProductMinorVersion)}
		CloseRegKey $(KeyProduct)
	Else
		goto fatalregistry
	EndIf
	goto end
successful = +
	goto end
abandon = +
	ForListDo $(OEM_ABANDON_OPTIONS)
		Shell $(UtilityInf), RemoveHardwareComponent, $(Manufacturer),+
		  $(ProductSoftwareName), $($)
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			goto ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			goto fatalregistry
		EndIf
	EndForListDo
	IfStr(i) $(OEM_ABANDON_SOFTWARE) == TRUE
		Shell $(UtilityInf), RemoveSoftwareComponent, $(Manufacturer),+
		  $(ProductSoftwareName), FALSE
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			goto ShellCodeError
		EndIf
		Set RegistryErrorIndex = $($R0)
		IfStr(i) $(RegistryErrorIndex) != NO_ERROR
			goto fatalregistry
		EndIf
	EndIf
	goto end
warning = +
	Shell $(subroutineinf), SetupMessage, $(!STF_LANGUAGE), "WARNING", $(Error)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		goto ShellCodeError
	EndIf
	IfStr(i) $($R1) == "OK"
		goto $(to)
	Else-IfStr(i) $($R1) == "CANCEL"
		goto $(from)
	Else
		goto "end"
	EndIf
nonfatalinfo = +
	Set CommonStatus	= STATUS_USERCANCEL
	Set Severity		= STATUS
	goto nonfatalmsg
nonfatal = +
	Set Severity		= NONFATAL
	goto nonfatalmsg
nonfatalmsg = +
	IfStr(i) $(Error) == ""
		Set Severity = NONFATAL
		Shell $(UtilityInf), RegistryErrorString, "SETUP_FAIL"
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			goto ShellCodeError
		EndIf
		Set Error = $($R0)
	EndIf
	Shell $(subroutineinf), SetupMessage, $(!STF_LANGUAGE), $(Severity), $(Error)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		goto ShellCodeError
	EndIf
	IfStr(i) $($R1) == "OK"
		goto $(from)
	Else
		goto "end"
	EndIf
fatalregistry = +
	Shell $(UtilityInf), RegistryErrorString, $(RegistryErrorIndex)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		goto ShellCodeError
	EndIf
	Set Error = $($R0)
	goto fatal
fataldetect = +
	Shell $(UtilityInf), RegistryErrorString, CANNOT_DETECT
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		goto ShellCodeError
	EndIf
	Set Error = $($R0)
	Goto fatal
fatal = +
	IfStr(i) $(Error) == ""
		Shell $(UtilityInf), RegistryErrorString, "SETUP_FAIL"
		IfInt $($ShellCode) != $(!SHELL_CODE_OK)
			goto ShellCodeError
		EndIf
		Set Error = $($R0)
	EndIf
	Shell $(subroutineinf), SetupMessage, $(!STF_LANGUAGE), "FATAL", $(Error)
	IfInt $($ShellCode) != $(!SHELL_CODE_OK)
		goto ShellCodeError
	EndIf
	goto setfailed
ShellCodeError = +
	Set DlgType		= "MessageBox"
	Set STF_MB_TITLE	= $(ShellCodeErrorTitle)
	Set STF_MB_TEXT 	= $(ShellCodeErrorText)
	Set STF_MB_TYPE 	= 1
	Set STF_MB_ICON 	= 3
	Set STF_MB_DEF		= 1
	ui start "Error Message"
	goto setfailed
setfailed = +
	Set CommonStatus = STATUS_FAILED
	IfStr(i) $(OEM_ABANDON_ON) == TRUE
		Set OEM_ABANDON_ON = FALSE
		goto abandon
	EndIf
	goto end
end = +
	Return $(CommonStatus)
[Install-HelpFile]
	Set STF_VITAL		= ""
	Set STF_OVERWRITE	= "VERIFYSOURCEOLDER"
	AddSectionFilesToCopyList Files-Hlp $(SrcDir) $(!STF_WINDOWSSYSPATH)
	AddSectionFilesToCopyList Files-Dll $(SrcDir) $(!STF_WINDOWSSYSPATH)
	Set !STF_NCPA_FLUSH_COPYLIST = TRUE
	CopyFilesInCopyList
	exit
[Install-Option]
	Set STF_VITAL = ""
	IfStr(i) $(AddCopy) == "YES"
		AddSectionFilesToCopyList Files-$(Option) $(SrcDir) +
		  $(!STF_WINDOWSSYSPATH)\drivers
	EndIf
	IfStr(i) $(DoCopy) == "YES"
		Set !STF_NCPA_FLUSH_COPYLIST = TRUE
		CopyFilesInCopyList
	EndIf
	Exit
[Install-Update]
	Set STF_VITAL	= ""
	Set STF_OVERWRITE	= "VERIFYSOURCEOLDER"
	AddSectionFilesToCopyList Files-$(Option) $(SrcDir) +
	  $(!STF_WINDOWSSYSPATH)\drivers
	AddSectionFilesToCopyList Files-Inf $(SrcDir) $(!STF_WINDOWSSYSPATH)
	AddSectionFilesToCopyList Files-Hlp $(SrcDir) $(!STF_WINDOWSSYSPATH)
	AddSectionFilesToCopyList Files-Dll $(SrcDir) $(!STF_WINDOWSSYSPATH)
	Set !STF_NCPA_FLUSH_COPYLIST = TRUE
	CopyFilesInCopyList
	Exit
[Source Media Descriptions]
	1  = "Windows NT Setup Disk #1"
	2  = "Windows NT Setup CD-ROM Disk"
	3  = "Driver CD"
[ProductType]
	STF_PRODUCT  = Winnt
	STF_PLATFORM = I386
[Files-Inf]
	3,	OemSetup.inf,	SIZE=32000,	RENAME=$(!UG_Filename)
[Files-Hlp]
	3,	gedialog.hlp,	SIZE=38000
[Files-Dll]
	3, 	gedialog.dll,	SIZE=17000


[Files-GEV2COPPER]
	3,  m4cxnt4.sys, 	SIZE=80000
[Files-GEY2COPPER4360]
	3,  m4cxnt4.sys, 	SIZE=80000

[LanguagesSupported]
	ENG
[OptionsTextENG]


	GEV2COPPER = "D-Link DGE-530T Gigabit Ethernet Adapter"
   

[FileConstantsENG]
	ProCaption	= "Windows NT Setup"
	ProCancel	= "Cancel"
	ProCancelMsg	= "Windows NT Networking is not correctly installed.  "+
			  "Are you sure you want to cancel copying files?"
	ProCancelCap	= "Network Setup Message"
	ProText1	= "Copying:"
	ProText2	= "To:"
	FunctionGEV2COPPERTitle 		= "D-Link DGE-530T Gigabit Ethernet Adapter Setup"
	ProductSoftwareGEV2COPPERDescription = "D-Link DGE-530T Gigabit Ethernet Adapter Driver"
	ProductHardwareGEV2COPPERDescription = "D-Link DGE-530T Gigabit Ethernet Adapter"
	ProductSoftwareGEV2COPPERTitle	= "D-Link DGE-530T Gigabit Ethernet Adapter Driver"
	ProductHardwareGEV2COPPERTitle	= "D-Link DGE-530T Gigabit Ethernet Adapter"
	
        
	

	ShellCodeErrorTitle		 = "Error: "$(Function$(Option)Title)
	ShellCodeErrorText		 = "Shell Code Error."
[DialogConstantsENG]
	Help		= "&Help"
	Exit		= "Cancel"
	OK		= "OK"
	Defaults	= "&Defaults"
	HelpContext	= ""
	Continue	= "Continue"
	Cancel		= "Cancel"


[FileDependentDlgGEV2COPPERENG]
	HelpFile		= gedialog
	IDH_DB_OEM_GEV2_INS	= 9151
	HelpContext		= $(IDH_DB_OEM_GEV2_INS)
	MinID			= 9000
	MaxID			= 9999
	Caption 		= $(Function$(Option)Title)
	DlgType 		= "RadioCombination"
	DlgTemplate		= "GE_V2COPPER"
	Combo1Label		= "Bus / &Slot:"
	Combo1Out		= $(SlotNumber)

	Combo2Label		= "&Jumbo Frame Support:"
    	Combo2List		= $(JumboSupportStrList)
	Combo2Out		= $(JumboSupportStr)

	Combo3Label		= "&Connection Type:"
    	Combo3List		= $(ConnectionTypeStrList)
	Combo3Out		= $(ConnectionTypeStr)

    	ComboListItemsIn	= {Combo1List, Combo2List,Combo3List}
    	ComboListItemsOut	= {Combo1Out, Combo2Out, Combo3Out}
	Edit1Label		= "Network &Address:"
	
	NotifyFields		= {NO}

	EditTextIn		= {$(NetworkAddress)}

	EditTextLim		= {17, 12}
	EditTextOut		= {}
	
[FileDependentDlgGEY2COPPER4360ENG]
	HelpFile		= gedialog
	IDH_DB_OEM_GEV2_INS	= 9152
	HelpContext		= $(IDH_DB_OEM_GEV2_INS)
	MinID			= 9000
	MaxID			= 9999
	Caption 		= $(Function$(Option)Title)
	DlgType 		= "RadioCombination"
	DlgTemplate		= "GE_V2COPPER"
	Combo1Label		= "Bus / &Slot:"
	Combo1Out		= $(SlotNumber)


	Combo2Label		= "&Jumbo Frame Support:"
    	Combo2List		= $(JumboSupportStrList)
	Combo2Out		= $(JumboSupportStr)

	Combo3Label		= "&Connection Type:"
    	Combo3List		= $(ConnectionTypeStrList)
	Combo3Out		= $(ConnectionTypeStr)

    	ComboListItemsIn	= {Combo1List, Combo2List,Combo3List}
    	ComboListItemsOut	= {Combo1Out, Combo2Out, Combo3Out}
	Edit1Label		= "Network &Address:"

	NotifyFields		= {NO}
	EditTextIn		= {$(NetworkAddress)}
	EditTextLim		= {17, 12}
	EditTextOut		= {}
;
; OemSetup.inf version 2.07
